package com.husawang.husa.activity.start;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.husawang.husa.R;
import com.husawang.husa.lib.base.activity.BaseActivity;
import com.husawang.husa.presenter.start.SplashPresenter;
import com.husawang.husa.view.start.ISplashView;

import net.wequick.small.Small;

/**
 * 启动图
 */
public class SplashActivity extends BaseActivity implements ISplashView{

	public ImageView splashIV;
	private SplashPresenter mSplashPresenter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);

		mSplashPresenter=new SplashPresenter(this);

		initWidget();
		initData();
	}

	private void initData() {
		mSplashPresenter.loadADpic();

	}

	private void initWidget() {

		splashIV=findViewById(R.id.iv_splash);

		setSplashBackground();

	}


	@Override
	public void setSplashBackground() {

		Glide.with(this).load(R.mipmap.bg_splach).into(splashIV);

	}

	@Override
	public void skipADpic() {
		splashIV.postDelayed(new Runnable() {
			@Override
			public void run() {
				Intent intent=new Intent(SplashActivity.this,AdActivity.class);
				startActivity(intent);
				finish();
			}
		},1200);
	}

	@Override
	public void skipHome() {
		splashIV.postDelayed(new Runnable() {
			@Override
			public void run() {
				Intent intent=new Intent(SplashActivity.this,HomeActivity.class);
				startActivity(intent);
				finish();
			}
		},1200);
	}


}
